/*
 * @Author: w
 * @Date: 2022-02-22 23:04:04
 * @Description: 剑指 Offer 50. 第一个只出现一次的字符
 */

// hashMap

/**
 * @param {string} s
 * @return {character}
 */

// hashMap
var firstUniqChar = function (s) {
  let map = new Map();
  for (let i = 0; i < s.length; i++) {
    map.set(s[i], map.has(s[i]));
  }
  for (let [k, v] of map) {
    if (v == false) {
      return k;
    }
  }
  return " ";
};
